package leetcode.code1525;

public class Solution {
	public int numSplits(String s) {
		int[] hash = new int[26];
		int right = 0;
		for (int i = 0; i < s.length(); i++) {
			int id = s.charAt(i) - 'a';
			hash[id]++;
			right |= 1 << id;
		}
		int left = 0, ans = 0;
		for (int i = 0; i < s.length(); i++) {
			int id = s.charAt(i) - 'a';
			if (--hash[id] == 0) {
				right ^= 1 << id;
			}
			left |= 1 << id;
			if (Integer.bitCount(left) == Integer.bitCount(right)) {
				ans++;
			}
		}
		return ans;
	}

	public static void main(String[] args) {
		System.out.println((((18 + 18) & 34) << 5));
	}
}
